Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace .Str() with .Stringer() for types that implement fmt.Stringer #121

Merged
merged 2 commits into from
Jan 16, 2025

Conversation

kirugan
Copy link
Contributor

@kirugan kirugan commented Jan 15, 2025

No description provided.

@@ -123,7 +123,7 @@ func (s *Service) watchForSpendSlashingChange(
if qualifiedStates == nil || !utils.Contains(qualifiedStates, *delegationState) {
log.Error().
Str("staking_tx", delegation.StakingTxHashHex).
Str("state", delegationState.String()).
Stringer("state", delegationState).
Copy link
Collaborator

@gusin13 gusin13 Jan 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question - does Stringer require a type to implement String() for example in above case if delegationState was not convertible to String then what would happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it does, passed argument must be fmt.Stringer

@kirugan kirugan merged commit ab2f9da into main Jan 16, 2025
11 checks passed
@kirugan kirugan deleted the kirugan/use-stringer-in-logs branch January 16, 2025 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants